﻿Imports System.IO
Imports System.IO.File
Imports Cognex.VisionPro

Public Class ParameterSet
    Dim Checkbox_Disable(30) As System.Windows.Forms.CheckBox
    Dim TextBox_Torq(30) As System.Windows.Forms.TextBox
    Dim TextBox_Angle(30) As System.Windows.Forms.TextBox
    Dim TextBox_feeder(30) As System.Windows.Forms.TextBox
    Dim ComboBox_Arch(30) As System.Windows.Forms.ComboBox
    Dim ComboBox_SP(30) As System.Windows.Forms.ComboBox
    Dim ComboBox_GP(30) As System.Windows.Forms.ComboBox
    Dim TextBox_High(30) As System.Windows.Forms.TextBox
    Dim TextBox_X轴(30) As System.Windows.Forms.TextBox
    Dim TextBox_Y轴(30) As System.Windows.Forms.TextBox
    Dim ComBox_XFS(30) As System.Windows.Forms.ComboBox

    Private Sub ParameterSet_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        initControl()
        TextBox_chanpin.Text = Chanpin
        TextBox_PointCount.Text = CurScrewPara.PointCount
        TextBox_ScrewSN.Text = CurScrewPara.ScrewSN
        Load_ZaxisPls()
        'TextBox_startDly.Text = StartDlyTime
        TextBox_IDLETIME.Text = IDLETime


        TextBox_KESU.Text = KESU.ToString
        CheckBox_ph3.Checked = Photo3_flag
        CheckBox_PhotoPY.Checked = PhotoPY_flag
        TextBox_PHPY.Text = PhotoPY
        YMin.Text = Y轴_最小偏差限制.ToString
        YMax.Text = Y轴_最大偏差限制.ToString

        If SN2Check = True Then                '单双条码切换
            SN2_Check.Checked = True
        Else
            SN2_Check.Checked = False
        End If
        If Online_Mod = 1 Then
            No_online.Checked = True
        ElseIf Online_Mod = 2 Then
            First_online.Checked = True
        ElseIf Online_Mod = 3 Then
            Mid_online.Checked = True
        ElseIf Online_Mod = 4 Then
            End_online.Checked = True
        End If
        If suofu_Mod = 1 Then
            CheckBox_PINSUO.Checked = True
            CheckBox_XIESUO.Checked = False
        ElseIf suofu_Mod = 2 Then
            CheckBox_PINSUO.Checked = False
            CheckBox_XIESUO.Checked = True
        End If

        If NumberOfPSetArray > 0 Then
            For i As Integer = 0 To NumberOfPSetArray - 1
                Select Case i + 1
                    Case 1
                        Pget1XPosCompensate.Text = Pget(i).XPosCompensate
                        Pget1YPosCompensate.Text = Pget(i).YPosCompensate
                        Pget1ZPosCompensate.Text = Pget(i).ZPosCompensate

                        Pset1XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset1YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset1ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset1RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 2
                        Pget2XPosCompensate.Text = Pget(i).XPosCompensate
                        Pget2YPosCompensate.Text = Pget(i).YPosCompensate
                        Pget2ZPosCompensate.Text = Pget(i).ZPosCompensate
                        Pset2XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset2YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset2ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset2RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 3
                        Pset3XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset3YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset3ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset3RPosCompensate.Text = Pset(i).RPosCompensate
                        XMin.Text = Pget(i).XPosCompensate 'X最小值
                        XMax.Text = Pget(i).YPosCompensate 'X最大值
                        Lenth.Text = Pget(i).ZPosCompensate '距离最大值
                    Case 4
                        Pset4XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset4YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset4ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset4RPosCompensate.Text = Pset(i).RPosCompensate
                        ADD_Screw_Count_Box.Text = Pget(i).XPosCompensate   '加螺丝报警次数
                        Retry_Times_box.Text = Pget(i).YPosCompensate
                        Clear_Time_Box.Text = Pget(i).ZPosCompensate
                    Case 5
                        Pget3XPosCompensate.Text = Pget(i).XPosCompensate
                        Pget3YPosCompensate.Text = Pget(i).YPosCompensate
                        Pget3ZPosCompensate.Text = Pget(i).ZPosCompensate
                        Pset5XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset5YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset5ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset5RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 6
                        Pget4XPosCompensate.Text = Pget(i).XPosCompensate
                        Pget4YPosCompensate.Text = Pget(i).YPosCompensate
                        Pget4ZPosCompensate.Text = Pget(i).ZPosCompensate
                        Pset6XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset6YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset6ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset6RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 7
                        Pset7XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset7YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset7ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset7RPosCompensate.Text = Pset(i).RPosCompensate
                        Photo_displacement.Text = Pget(i).YPosCompensate
                        ' Access_check.Checked = Access_enable
                    Case 8
                        Pset8XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset8YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset8ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset8RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 9
                        Pset9XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset9YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset9ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset9RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 10
                        Pset10XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset10YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset10ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset10RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 11
                        Pset11XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset11YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset11ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset11RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 12
                        Pset12XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset12YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset12ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset12RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 13
                        Pset13XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset13YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset13ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset13RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 14
                        Pset14XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset14YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset14ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset14RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 15
                        Pset15XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset15YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset15ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset15RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 16
                        Pset16XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset16YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset16ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset16RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 17
                        Pset17XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset17YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset17ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset17RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 18
                        Pset18XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset18YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset18ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset18RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 19
                        Pset19XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset19YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset19ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset19RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 20
                        Pset20XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset20YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset20ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset20RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 21
                        Pset21XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset21YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset21ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset21RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 22
                        Pset22XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset22YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset22ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset22RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 23
                        Pset23XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset23YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset23ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset23RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 24
                        Pset24XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset24YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset24ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset24RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 25
                        Pset25XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset25YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset25ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset25RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 26
                        Pset26XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset26YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset26ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset26RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 27
                        Pset27XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset27YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset27ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset27RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 28
                        Pset28XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset28YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset28ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset28RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 29
                        Pset29XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset29YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset29ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset29RPosCompensate.Text = Pset(i).RPosCompensate
                    Case 30
                        Pset30XPosCompensate.Text = Pset(i).XPosCompensate
                        Pset30YPosCompensate.Text = Pset(i).YPosCompensate
                        Pset30ZPosCompensate.Text = Pset(i).ZPosCompensate
                        Pset30RPosCompensate.Text = Pset(i).RPosCompensate
                End Select
            Next

        Else

        End If

        If NumberOfSet > 0 Then
            For i As Integer = 0 To NumberOfSet - 1
                Select Case i + 1
                    Case 1
                        SNScan.Checked = newset(i)
                    Case 2
                        RePick.Checked = newset(i)
                        'Case 3
                        '    Master.Checked = newset(i)
                        'Case 4
                        '    Slave1.Checked = newset(i)
                        'Case 5
                        '    Slave2.Checked = newset(i)
                        'Case 6
                        '    Slave3.Checked = newset(i)
                    Case 7
                        Clear.Checked = newset(i)
                    Case 8
                        UploadEnable.Checked = newset(i)
                End Select
            Next
        End If
        Dim tmpfifo1 As CogAcqFifoTool = gTBCheck(0).Tools.Item("相机设定")
        Dim tmpfifo2 As CogAcqFifoTool = gTBCheck(1).Tools.Item("相机设定")

        exposure1_TEXT.Text = tmpfifo1.Operator.OwnedExposureParams.Exposure
        exposure2_TEXT.Text = tmpfifo2.Operator.OwnedExposureParams.Exposure
    End Sub



    Private Sub Save_Btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save_Btn.Click
        Dim filepath = DebugPath & "\Tool\" & Chanpin & "\"
        Dim PSetfile_num As Integer = FreeFile()
        Dim Getfile_num As Integer = FreeFile()
        Dim Setfile_num As Integer = FreeFile()
        Dim Robot_Or_Access As Integer = FreeFile()
        Dim Para_num As Integer = FreeFile()
        Dim PsetCompensate As PsetSetting
        Dim OpenPsetsetting As Boolean = Exists(filepath & "Psetsetting.txt")
        Dim OpenParameter As Boolean = Exists(filepath & "Parameter.txt")
        '保存Z相检测设定
        Save_ZaxisPls()

        '保存螺丝参数
        CurScrewPara.PointCount = Val(TextBox_PointCount.Text)
        SNInfo.Screw_Qty = CurScrewPara.PointCount
        CurScrewPara.ScrewSN = TextBox_ScrewSN.Text

        FileOpen(Para_num, filepath & "Parameter.txt", OpenMode.Random)
        FilePut(Para_num, CurScrewPara)
        FileClose(Para_num)
        FrmMain.TextBox_CurScrewSN.Text = CurScrewPara.ScrewSN

        '保存点位参数
        FileOpen(PSetfile_num, filepath & "Psetsetting.txt", OpenMode.Random)

        '取料点保存
        PsetCompensate.XPosCompensate = Val(Pset1XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset1YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset1ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset1RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(0) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset2XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset2YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset2ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset2RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(1) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset3XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset3YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset3ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset3RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(2) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset4XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset4YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset4ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset4RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(3) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset5XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset5YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset5ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset5RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(4) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset6XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset6YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset6ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset6RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(5) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset7XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset7YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset7ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset7RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(6) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset8XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset8YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset8ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset8RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(7) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset9XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset9YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset9ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset9RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(8) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset10XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset10YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset10ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset10RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(9) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset11XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset11YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset11ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset11RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(10) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset12XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset12YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset12ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset12RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(11) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset13XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset13YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset13ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset13RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(12) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset14XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset14YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset14ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset14RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(13) = PsetCompensate


        PsetCompensate.XPosCompensate = Val(Pset15XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset15YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset15ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset15RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(14) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset16XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset16YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset16ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset16RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(15) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset17XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset17YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset17ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset17RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(16) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset18XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset18YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset18ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset18RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(17) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset19XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset19YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset19ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset19RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(18) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset20XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset20YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset20ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset20RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(19) = PsetCompensate


        PsetCompensate.XPosCompensate = Val(Pset21XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset21YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset21ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset21RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(20) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset22XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset22YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset22ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset22RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(21) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset23XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset23YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset23ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset23RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(22) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset24XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset24YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset24ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset24RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(23) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset25XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset25YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset25ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset25RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(24) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset26XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset26YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset26ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset26RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(25) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset27XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset27YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset27ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset27RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(26) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset28XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset28YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset28ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset28RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(27) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset29XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset29YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset29ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset29RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(28) = PsetCompensate

        PsetCompensate.XPosCompensate = Val(Pset30XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pset30YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pset30ZPosCompensate.Text)
        PsetCompensate.RPosCompensate = Val(Pset30RPosCompensate.Text)
        FilePut(PSetfile_num, PsetCompensate)
        Pset(29) = PsetCompensate

        FileClose(PSetfile_num)

        'Robot_Or_Access
        'FileOpen(Robot_Or_Access, DebugPath & "\Tool\" & "Robot_Or_Access.txt", OpenMode.Random)
        'Access_enable = Val(Access_check.Checked)
        'FilePut(Robot_Or_Access, Access_enable)
        'FileClose(Robot_Or_Access)

        'Get
        FileOpen(Getfile_num, DebugPath & "\Tool\" & "Get.txt", OpenMode.Random)
        PsetCompensate.XPosCompensate = Val(Pget1XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pget1YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pget1ZPosCompensate.Text)
        FilePut(Getfile_num, PsetCompensate)
        Pget(0) = PsetCompensate
        PsetCompensate.XPosCompensate = Val(Pget2XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pget2YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pget2ZPosCompensate.Text)
        FilePut(Getfile_num, PsetCompensate)
        Pget(1) = PsetCompensate
        PsetCompensate.XPosCompensate = Val(XMin.Text)
        PsetCompensate.YPosCompensate = Val(XMax.Text)
        PsetCompensate.ZPosCompensate = Val(Lenth.Text)
        FilePut(Getfile_num, PsetCompensate)
        Pget(2) = PsetCompensate
        PsetCompensate.XPosCompensate = Val(ADD_Screw_Count_Box.Text)
        PsetCompensate.YPosCompensate = Val(Retry_Times_box.Text)
        PsetCompensate.ZPosCompensate = Val(Clear_Time_Box.Text)
        FilePut(Getfile_num, PsetCompensate)
        Pget(3) = PsetCompensate
        ADD_Screw_Count = Pget(3).XPosCompensate
        Retry_Times = Pget(3).YPosCompensate
        Clear_Time = Pget(3).ZPosCompensate

        PsetCompensate.XPosCompensate = Val(Pget3XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pget3YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pget3ZPosCompensate.Text)
        FilePut(Getfile_num, PsetCompensate)
        Pget(4) = PsetCompensate
        PsetCompensate.XPosCompensate = Val(Pget4XPosCompensate.Text)
        PsetCompensate.YPosCompensate = Val(Pget4YPosCompensate.Text)
        PsetCompensate.ZPosCompensate = Val(Pget4ZPosCompensate.Text)
        FilePut(Getfile_num, PsetCompensate)
        Pget(5) = PsetCompensate

        PsetCompensate.YPosCompensate = Val(Photo_displacement.Text)

        FilePut(Getfile_num, PsetCompensate)
        Pget(6) = PsetCompensate
        FileClose(Getfile_num)

        ' set
        FileOpen(Setfile_num, DebugPath & "\Tool\" & "Set.txt", OpenMode.Random)
        newset(0) = SNScan.Checked
        FilePut(Setfile_num, SNScan.Checked)
        newset(1) = RePick.Checked
        FilePut(Setfile_num, RePick.Checked)
        newset(2) = False
        FilePut(Setfile_num, False)
        newset(3) = False
        FilePut(Setfile_num, False)
        newset(4) = False
        FilePut(Setfile_num, False)
        newset(5) = False
        FilePut(Setfile_num, False)
        newset(6) = Clear.Checked
        FilePut(Setfile_num, Clear.Checked)
        newset(7) = UploadEnable.Checked
        FilePut(Setfile_num, UploadEnable.Checked)
        FileClose(Setfile_num)

        '螺丝点参数保存至数据库
        SavePointPara()

        '螺丝点参数保存至数据库
        If newset(7) = False Then
            FrmMain.CloseUploadProcess()
        End If
        '保存开机延时
        Dim startDly_num As Integer = FreeFile()
        'StartDlyTime = Val(TextBox_startDly.Text)
        IDLETime = Val(TextBox_IDLETIME.Text)
        FileOpen(startDly_num, DebugPath & "\Tool\" & "StartDlyTime.txt", OpenMode.Random)
        FilePut(startDly_num, StartDlyTime)
        FilePut(startDly_num, IDLETime)
        FileClose(startDly_num)

        '保存拓展数据第三个拍照点，以及联机方式,锁付模组
        Dim startDly As Integer = FreeFile()
        Photo3_flag = CheckBox_ph3.Checked               '启动第三拍照点标志
        KESU = Val(TextBox_KESU.Text)                    '第三拍照点颗数
        If No_online.Checked = True Then                 '单独不联机
            Online_Mod = 1
        ElseIf First_online.Checked = True Then          '联机第一台
            Online_Mod = 2
        ElseIf Mid_online.Checked = True Then            '联机中间一台
            Online_Mod = 3
        ElseIf End_online.Checked = True Then            '联机最后一台
            Online_Mod = 4
        End If
        If CheckBox_PINSUO.Checked = True Then           '平锁模组
            CheckBox_XIESUO.Checked = False
            suofu_Mod = 1
        ElseIf CheckBox_XIESUO.Checked = True Then       '斜锁模组
            CheckBox_PINSUO.Checked = False
            suofu_Mod = 2
        End If
        If SN2_Check.Checked = True Then                '单双条码切换
            SN2Check = True
        Else
            SN2Check = False
        End If
        Y轴_最小偏差限制 = Val(YMin.Text)
        Y轴_最大偏差限制 = Val(YMax.Text)
        FileOpen(startDly, DebugPath & "\Tool\Photo3.txt", OpenMode.Random)
        FilePut(startDly, Photo3_flag)
        FilePut(startDly, KESU)
        FilePut(startDly, Online_Mod)
        FilePut(startDly, suofu_Mod)
        FilePut(startDly, SN2Check)
        FilePut(startDly, Y轴_最小偏差限制)
        FilePut(startDly, Y轴_最大偏差限制)
        FileClose(startDly)

        PhotoPY_flag = CheckBox_PhotoPY.Checked          '第一第二拍照点偏移启动标志
        PhotoPY = TextBox_PHPY.Text                      '第一第二拍照点Y轴偏移量

        FileOpen(startDly, filepath & "\Photo-PH.txt", OpenMode.Random)
        FilePut(startDly, PhotoPY_flag)
        FilePut(startDly, PhotoPY)
        FileClose(startDly)
        '' CCD扫码切换程序
        'Dim Setfile_num2 As Integer = FreeFile()
        'If CCD_SN.Checked = True Then
        '    SN_CheckMode = 1
        'ElseIf NO_CheckSN.Checked = True Then
        '    SN_CheckMode = 0
        'End If
        'FileOpen(Setfile_num2, DebugPath & "\Tool\" & "SNdate.txt", OpenMode.Random)
        'FilePut(Setfile_num2, SN_CheckMode)
        'FileClose(Setfile_num2)

        '保存路径值
        SavePointWay()
        '保存系统设置
        SaveSystemPara()

        Dim tmpfifo1 As CogAcqFifoTool = gTBCheck(0).Tools.Item("相机设定")
        tmpfifo1.Operator.OwnedExposureParams.Exposure = CDbl(exposure1_TEXT.Text)
        Dim tmpfifo2 As CogAcqFifoTool = gTBCheck(1).Tools.Item("相机设定")
        tmpfifo2.Operator.OwnedExposureParams.Exposure = CDbl(exposure2_TEXT.Text)
        For i As Integer = 0 To 1
            CogSerializer.SaveObjectToFile(gTBCheck(i), filepath & "TBCheck" & (i + 1).ToString & ".vpp")
        Next
        MsgBox("保存成功！")
    End Sub
    Private Sub Save_ZaxisPls()

        Dim filepath = DebugPath & "\Tool\" & Chanpin & "\"
        Dim Zcheckpls_num As Integer = FreeFile()
        Dim OpenZpls As Boolean = Exists(filepath & "ZaxisCheck.txt")
        Dim s As String = ""
        Try

            FileOpen(Zcheckpls_num, filepath & "ZaxisCheck.txt", OpenMode.Random)

            ZaxisPls(0) = TextBox_ZplsRange.Text
            ZaxisPls(1) = TextBox_Zpls1.Text
            ZaxisPls(2) = TextBox_Zpls2.Text
            ZaxisPls(3) = TextBox_Zpls3.Text
            ZaxisPls(4) = TextBox_Zpls4.Text
            ZaxisPls(5) = TextBox_Zpls5.Text
            ZaxisPls(6) = TextBox_Zpls6.Text
            ZaxisPls(7) = TextBox_Zpls7.Text
            ZaxisPls(8) = TextBox_Zpls8.Text
            ZaxisPls(9) = TextBox_Zpls9.Text
            ZaxisPls(10) = TextBox_Zpls10.Text
            ZaxisPls(11) = TextBox_Zpls11.Text
            ZaxisPls(12) = TextBox_Zpls12.Text
            ZaxisPls(13) = TextBox_Zpls13.Text
            ZaxisPls(14) = TextBox_Zpls14.Text
            ZaxisPls(15) = TextBox_Zpls15.Text
            ZaxisPls(16) = TextBox_Zpls16.Text
            ZaxisPls(17) = TextBox_Zpls17.Text
            ZaxisPls(18) = TextBox_Zpls18.Text
            ZaxisPls(19) = TextBox_Zpls19.Text
            ZaxisPls(20) = TextBox_Zpls20.Text
            ZaxisPls(21) = TextBox_Zpls21.Text
            ZaxisPls(22) = TextBox_Zpls22.Text
            ZaxisPls(23) = TextBox_Zpls23.Text
            ZaxisPls(24) = TextBox_Zpls24.Text
            ZaxisPls(25) = TextBox_Zpls25.Text
            ZaxisPls(26) = TextBox_Zpls26.Text
            ZaxisPls(27) = TextBox_Zpls27.Text
            ZaxisPls(28) = TextBox_Zpls28.Text
            ZaxisPls(29) = TextBox_Zpls29.Text
            ZaxisPls(30) = TextBox_Zpls30.Text
            ZaxisCheckUSE = ZaxisCheck.Checked

            For i = 0 To ZaxisPls.Length - 1
                s += ZaxisPls(i).ToString & ","
            Next
            s += ZaxisCheckUSE.ToString
            FilePut(Zcheckpls_num, s)
            FileClose(Zcheckpls_num)
        Catch ex As Exception
            MsgBox("Save_ZaxisPls:" & ex.Message.ToString)
        End Try
    End Sub

    Private Sub Load_ZaxisPls()
        Dim filepath = DebugPath & "\Tool\" & Chanpin & "\"
        Dim Zcheckpls_num As Integer = FreeFile()
        Dim OpenZpls As Boolean = Exists(filepath & "ZaxisCheck.txt")
        Dim s As String = ""
        Dim ss() As String
        Try

            If OpenZpls = True Then
                FileOpen(Zcheckpls_num, filepath & "ZaxisCheck.txt", OpenMode.Random)
                FileGet(Zcheckpls_num, s)
                ss = Split(s, ",")

                TextBox_ZplsRange.Text = ss(0)
                TextBox_Zpls1.Text = ss(1)
                TextBox_Zpls2.Text = ss(2)
                TextBox_Zpls3.Text = ss(3)
                TextBox_Zpls4.Text = ss(4)
                TextBox_Zpls5.Text = ss(5)
                TextBox_Zpls6.Text = ss(6)
                TextBox_Zpls7.Text = ss(7)
                TextBox_Zpls8.Text = ss(8)
                TextBox_Zpls9.Text = ss(9)
                TextBox_Zpls10.Text = ss(10)
                TextBox_Zpls11.Text = ss(11)
                TextBox_Zpls12.Text = ss(12)
                TextBox_Zpls13.Text = ss(13)
                TextBox_Zpls14.Text = ss(14)
                TextBox_Zpls15.Text = ss(15)
                TextBox_Zpls16.Text = ss(16)
                TextBox_Zpls17.Text = ss(17)
                TextBox_Zpls18.Text = ss(18)
                TextBox_Zpls19.Text = ss(19)
                TextBox_Zpls20.Text = ss(20)
                TextBox_Zpls21.Text = ss(21)
                TextBox_Zpls22.Text = ss(22)
                TextBox_Zpls23.Text = ss(23)
                TextBox_Zpls24.Text = ss(24)
                TextBox_Zpls25.Text = ss(25)
                TextBox_Zpls26.Text = ss(26)
                TextBox_Zpls27.Text = ss(27)
                TextBox_Zpls28.Text = ss(28)
                TextBox_Zpls29.Text = ss(29)
                TextBox_Zpls30.Text = ss(30)
                ZaxisCheck.Checked = ss(31)

                For i = 0 To 30
                    ZaxisPls(i) = Val(ss(i))
                Next
                ZaxisCheckUSE = ss(31)
                FileClose(Zcheckpls_num)
            Else
                TextBox_ZplsRange.Text = 0
                TextBox_Zpls1.Text = 0
                TextBox_Zpls2.Text = 0
                TextBox_Zpls3.Text = 0
                TextBox_Zpls4.Text = 0
                TextBox_Zpls5.Text = 0
                TextBox_Zpls6.Text = 0
                TextBox_Zpls7.Text = 0
                TextBox_Zpls8.Text = 0
                TextBox_Zpls9.Text = 0
                TextBox_Zpls10.Text = 0
                TextBox_Zpls11.Text = 0
                TextBox_Zpls12.Text = 0
                TextBox_Zpls13.Text = 0
                TextBox_Zpls14.Text = 0
                TextBox_Zpls15.Text = 0
                TextBox_Zpls16.Text = 0
                TextBox_Zpls17.Text = 0
                TextBox_Zpls18.Text = 0
                TextBox_Zpls19.Text = 0
                TextBox_Zpls20.Text = 0
                TextBox_Zpls21.Text = 0
                TextBox_Zpls22.Text = 0
                TextBox_Zpls23.Text = 0
                TextBox_Zpls24.Text = 0
                TextBox_Zpls25.Text = 0
                TextBox_Zpls26.Text = 0
                TextBox_Zpls27.Text = 0
                TextBox_Zpls28.Text = 0
                TextBox_Zpls29.Text = 0
                TextBox_Zpls30.Text = 0
                ZaxisCheck.Checked = False
                For i = 0 To 30
                    ZaxisPls(i) = 0
                Next
                ZaxisCheckUSE = False
            End If
        Catch ex As Exception

        End Try
    End Sub
    Private Sub SavePointPara()
        Dim i As Integer = 0
        Try
            Dim sql1 As String = ""
            Dim DBpath As String = DebugPath & "\Tool\" & Chanpin & "\PointPara.accdb"
            Dim cnStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " & DBpath & ";Persist Security Info=False;Jet OLEDB:Database Password='1234';"
            '保存扭力角度供料器enable信息
            'For i = 1 To 30
            '    If i < 10 Then
            '        sql1 = " update " & " PointPara " & "set torque=" & TextBox_Torq(i).Text & ",angle=" & TextBox_Angle(i).Text & ",feeder=" & TextBox_feeder(i).Text & ",disable=" & Checkbox_Disable(i).Checked.ToString & " where PointName=" & "'set0" & i & "'"
            '    Else
            '        sql1 = " update " & " PointPara " & "set torque=" & TextBox_Torq(i).Text & ",angle=" & TextBox_Angle(i).Text & ",feeder=" & TextBox_feeder(i).Text & ",disable=" & Checkbox_Disable(i).Checked.ToString & " where PointName=" & "'set" & i & "'"
            '    End If

            '    HandleDB(sql1, cnStr)
            'Next
            '保存扭力角度供料器enable、路径信息
            For i = 1 To 30
                If i < 10 Then
                    sql1 = " update " & " PointPara " & "set torque=" & TextBox_Torq(i).Text & ",angle=" & TextBox_Angle(i).Text & ",feeder=" & TextBox_feeder(i).Text & ",disable=" & Checkbox_Disable(i).Checked.ToString & ",ArchNO=" & (ComboBox_Arch(i).SelectedIndex + 1).ToString & ",GetPassNO=" & ComboBox_GP(i).SelectedIndex.ToString & ",SetPassNO=" & ComboBox_SP(i).SelectedIndex.ToString & " where PointName=" & "'set0" & i & "' and Product='" & Chanpin & "'"
                Else
                    sql1 = " update " & " PointPara " & "set torque=" & TextBox_Torq(i).Text & ",angle=" & TextBox_Angle(i).Text & ",feeder=" & TextBox_feeder(i).Text & ",disable=" & Checkbox_Disable(i).Checked.ToString & ",ArchNO=" & (ComboBox_Arch(i).SelectedIndex + 1).ToString & ",GetPassNO=" & ComboBox_GP(i).SelectedIndex.ToString & ",SetPassNO=" & ComboBox_SP(i).SelectedIndex.ToString & " where PointName=" & "'set" & i & "' and Product='" & Chanpin & "'"
                End If
                HandleMysql(sql1)
            Next

            For i = 1 To 30
                PointPara(i).torque = TextBox_Torq(i).Text
                PointPara(i).angle = TextBox_Angle(i).Text
                PointPara(i).feeder = TextBox_feeder(i).Text
                PointPara(i).diable = Checkbox_Disable(i).Checked

                PointPass(i).X = ComboBox_Arch(i).SelectedIndex + 1
                PointPass(i).Y = ComboBox_GP(i).SelectedIndex
                PointPass(i).Z = ComboBox_SP(i).SelectedIndex
            Next

        Catch ex As Exception
            MsgBox("SavePointPara err:" & ex.Message.ToString)
        End Try
    End Sub


    ''' <summary>
    ''' 将控件存入数组
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub initControl()

        Try

            '禁用按钮组
            Checkbox_Disable(1) = CheckBox_disable1
            Checkbox_Disable(2) = CheckBox_disable2
            Checkbox_Disable(3) = CheckBox_disable3
            Checkbox_Disable(4) = CheckBox_disable4
            Checkbox_Disable(5) = CheckBox_disable5
            Checkbox_Disable(6) = CheckBox_disable6
            Checkbox_Disable(7) = CheckBox_disable7
            Checkbox_Disable(8) = CheckBox_disable8
            Checkbox_Disable(9) = CheckBox_disable9
            Checkbox_Disable(10) = CheckBox_disable10
            Checkbox_Disable(11) = CheckBox_disable11
            Checkbox_Disable(12) = CheckBox_disable12
            Checkbox_Disable(13) = CheckBox_disable13
            Checkbox_Disable(14) = CheckBox_disable14
            Checkbox_Disable(15) = CheckBox_disable15
            Checkbox_Disable(16) = CheckBox_disable16
            Checkbox_Disable(17) = CheckBox_disable17
            Checkbox_Disable(18) = CheckBox_disable18
            Checkbox_Disable(19) = CheckBox_disable19
            Checkbox_Disable(20) = CheckBox_disable20
            Checkbox_Disable(21) = CheckBox_disable21
            Checkbox_Disable(22) = CheckBox_disable22
            Checkbox_Disable(23) = CheckBox_disable23
            Checkbox_Disable(24) = CheckBox_disable24
            Checkbox_Disable(25) = CheckBox_disable25
            Checkbox_Disable(26) = CheckBox_disable26
            Checkbox_Disable(27) = CheckBox_disable27
            Checkbox_Disable(28) = CheckBox_disable28
            Checkbox_Disable(29) = CheckBox_disable29
            Checkbox_Disable(30) = CheckBox_disable30

            '扭力设置组
            TextBox_Torq(1) = TextBox_Torq1
            TextBox_Torq(2) = TextBox_Torq2
            TextBox_Torq(3) = TextBox_Torq3
            TextBox_Torq(4) = TextBox_Torq4
            TextBox_Torq(5) = TextBox_Torq5
            TextBox_Torq(6) = TextBox_Torq6
            TextBox_Torq(7) = TextBox_Torq7
            TextBox_Torq(8) = TextBox_Torq8
            TextBox_Torq(9) = TextBox_Torq9
            TextBox_Torq(10) = TextBox_Torq10
            TextBox_Torq(11) = TextBox_Torq11
            TextBox_Torq(12) = TextBox_Torq12
            TextBox_Torq(13) = TextBox_Torq13
            TextBox_Torq(14) = TextBox_Torq14
            TextBox_Torq(15) = TextBox_Torq15
            TextBox_Torq(16) = TextBox_Torq16
            TextBox_Torq(17) = TextBox_Torq17
            TextBox_Torq(18) = TextBox_Torq18
            TextBox_Torq(19) = TextBox_Torq19
            TextBox_Torq(20) = TextBox_Torq20
            TextBox_Torq(21) = TextBox_Torq21
            TextBox_Torq(22) = TextBox_Torq22
            TextBox_Torq(23) = TextBox_Torq23
            TextBox_Torq(24) = TextBox_Torq24
            TextBox_Torq(25) = TextBox_Torq25
            TextBox_Torq(26) = TextBox_Torq26
            TextBox_Torq(27) = TextBox_Torq27
            TextBox_Torq(28) = TextBox_Torq28
            TextBox_Torq(29) = TextBox_Torq29
            TextBox_Torq(30) = TextBox_Torq30

            '角度设置组
            TextBox_Angle(1) = TextBox_Angle1
            TextBox_Angle(2) = TextBox_Angle2
            TextBox_Angle(3) = TextBox_Angle3
            TextBox_Angle(4) = TextBox_Angle4
            TextBox_Angle(5) = TextBox_Angle5
            TextBox_Angle(6) = TextBox_Angle6
            TextBox_Angle(7) = TextBox_Angle7
            TextBox_Angle(8) = TextBox_Angle8
            TextBox_Angle(9) = TextBox_Angle9
            TextBox_Angle(10) = TextBox_Angle10
            TextBox_Angle(11) = TextBox_Angle11
            TextBox_Angle(12) = TextBox_Angle12
            TextBox_Angle(13) = TextBox_Angle13
            TextBox_Angle(14) = TextBox_Angle14
            TextBox_Angle(15) = TextBox_Angle15
            TextBox_Angle(16) = TextBox_Angle16
            TextBox_Angle(17) = TextBox_Angle17
            TextBox_Angle(18) = TextBox_Angle18
            TextBox_Angle(19) = TextBox_Angle19
            TextBox_Angle(20) = TextBox_Angle20
            TextBox_Angle(21) = TextBox_Angle21
            TextBox_Angle(22) = TextBox_Angle22
            TextBox_Angle(23) = TextBox_Angle23
            TextBox_Angle(24) = TextBox_Angle24
            TextBox_Angle(25) = TextBox_Angle25
            TextBox_Angle(26) = TextBox_Angle26
            TextBox_Angle(27) = TextBox_Angle27
            TextBox_Angle(28) = TextBox_Angle28
            TextBox_Angle(29) = TextBox_Angle29
            TextBox_Angle(30) = TextBox_Angle30

            '供料器设置组
            TextBox_feeder(1) = TextBox_feeder1
            TextBox_feeder(2) = TextBox_feeder2
            TextBox_feeder(3) = TextBox_feeder3
            TextBox_feeder(4) = TextBox_feeder4
            TextBox_feeder(5) = TextBox_feeder5
            TextBox_feeder(6) = TextBox_feeder6
            TextBox_feeder(7) = TextBox_feeder7
            TextBox_feeder(8) = TextBox_feeder8
            TextBox_feeder(9) = TextBox_feeder9
            TextBox_feeder(10) = TextBox_feeder10
            TextBox_feeder(11) = TextBox_feeder11
            TextBox_feeder(12) = TextBox_feeder12
            TextBox_feeder(13) = TextBox_feeder13
            TextBox_feeder(14) = TextBox_feeder14
            TextBox_feeder(15) = TextBox_feeder15
            TextBox_feeder(16) = TextBox_feeder16
            TextBox_feeder(17) = TextBox_feeder17
            TextBox_feeder(18) = TextBox_feeder18
            TextBox_feeder(19) = TextBox_feeder19
            TextBox_feeder(20) = TextBox_feeder20
            TextBox_feeder(21) = TextBox_feeder21
            TextBox_feeder(22) = TextBox_feeder22
            TextBox_feeder(23) = TextBox_feeder23
            TextBox_feeder(24) = TextBox_feeder24
            TextBox_feeder(25) = TextBox_feeder25
            TextBox_feeder(26) = TextBox_feeder26
            TextBox_feeder(27) = TextBox_feeder27
            TextBox_feeder(28) = TextBox_feeder28
            TextBox_feeder(29) = TextBox_feeder29
            TextBox_feeder(30) = TextBox_feeder30

            '弧形指定组 
            ComboBox_Arch(1) = ComboBox_Arch1
            ComboBox_Arch(2) = ComboBox_Arch2
            ComboBox_Arch(3) = ComboBox_Arch3
            ComboBox_Arch(4) = ComboBox_Arch4
            ComboBox_Arch(5) = ComboBox_Arch5
            ComboBox_Arch(6) = ComboBox_Arch6
            ComboBox_Arch(7) = ComboBox_Arch7
            ComboBox_Arch(8) = ComboBox_Arch8
            ComboBox_Arch(9) = ComboBox_Arch9
            ComboBox_Arch(10) = ComboBox_Arch10
            ComboBox_Arch(11) = ComboBox_Arch11
            ComboBox_Arch(12) = ComboBox_Arch12
            ComboBox_Arch(13) = ComboBox_Arch13
            ComboBox_Arch(14) = ComboBox_Arch14
            ComboBox_Arch(15) = ComboBox_Arch15
            ComboBox_Arch(16) = ComboBox_Arch16
            ComboBox_Arch(17) = ComboBox_Arch17
            ComboBox_Arch(18) = ComboBox_Arch18
            ComboBox_Arch(19) = ComboBox_Arch19
            ComboBox_Arch(20) = ComboBox_Arch20
            ComboBox_Arch(21) = ComboBox_Arch21
            ComboBox_Arch(22) = ComboBox_Arch22
            ComboBox_Arch(23) = ComboBox_Arch23
            ComboBox_Arch(24) = ComboBox_Arch24
            ComboBox_Arch(25) = ComboBox_Arch25
            ComboBox_Arch(26) = ComboBox_Arch26
            ComboBox_Arch(27) = ComboBox_Arch27
            ComboBox_Arch(28) = ComboBox_Arch28
            ComboBox_Arch(29) = ComboBox_Arch29
            ComboBox_Arch(30) = ComboBox_Arch30
            '放料避障组 
            ComboBox_SP(1) = ComboBox_SP1
            ComboBox_SP(2) = ComboBox_SP2
            ComboBox_SP(3) = ComboBox_SP3
            ComboBox_SP(4) = ComboBox_SP4
            ComboBox_SP(5) = ComboBox_SP5
            ComboBox_SP(6) = ComboBox_SP6
            ComboBox_SP(7) = ComboBox_SP7
            ComboBox_SP(8) = ComboBox_SP8
            ComboBox_SP(9) = ComboBox_SP9
            ComboBox_SP(10) = ComboBox_SP10
            ComboBox_SP(11) = ComboBox_SP11
            ComboBox_SP(12) = ComboBox_SP12
            ComboBox_SP(13) = ComboBox_SP13
            ComboBox_SP(14) = ComboBox_SP14
            ComboBox_SP(15) = ComboBox_SP15
            ComboBox_SP(16) = ComboBox_SP16
            ComboBox_SP(17) = ComboBox_SP17
            ComboBox_SP(18) = ComboBox_SP18
            ComboBox_SP(19) = ComboBox_SP19
            ComboBox_SP(20) = ComboBox_SP20
            ComboBox_SP(21) = ComboBox_SP21
            ComboBox_SP(22) = ComboBox_SP22
            ComboBox_SP(23) = ComboBox_SP23
            ComboBox_SP(24) = ComboBox_SP24
            ComboBox_SP(25) = ComboBox_SP25
            ComboBox_SP(26) = ComboBox_SP26
            ComboBox_SP(27) = ComboBox_SP27
            ComboBox_SP(28) = ComboBox_SP28
            ComboBox_SP(29) = ComboBox_SP29
            ComboBox_SP(30) = ComboBox_SP30
            '取料避障组
            ComboBox_GP(1) = ComboBox_GP1
            ComboBox_GP(2) = ComboBox_GP2
            ComboBox_GP(3) = ComboBox_GP3
            ComboBox_GP(4) = ComboBox_GP4
            ComboBox_GP(5) = ComboBox_GP5
            ComboBox_GP(6) = ComboBox_GP6
            ComboBox_GP(7) = ComboBox_GP7
            ComboBox_GP(8) = ComboBox_GP8
            ComboBox_GP(9) = ComboBox_GP9
            ComboBox_GP(10) = ComboBox_GP10
            ComboBox_GP(11) = ComboBox_GP11
            ComboBox_GP(12) = ComboBox_GP12
            ComboBox_GP(13) = ComboBox_GP13
            ComboBox_GP(14) = ComboBox_GP14
            ComboBox_GP(15) = ComboBox_GP15
            ComboBox_GP(16) = ComboBox_GP16
            ComboBox_GP(17) = ComboBox_GP17
            ComboBox_GP(18) = ComboBox_GP18
            ComboBox_GP(19) = ComboBox_GP19
            ComboBox_GP(20) = ComboBox_GP20
            ComboBox_GP(21) = ComboBox_GP21
            ComboBox_GP(22) = ComboBox_GP22
            ComboBox_GP(23) = ComboBox_GP23
            ComboBox_GP(24) = ComboBox_GP24
            ComboBox_GP(25) = ComboBox_GP25
            ComboBox_GP(26) = ComboBox_GP26
            ComboBox_GP(27) = ComboBox_GP27
            ComboBox_GP(28) = ComboBox_GP28
            ComboBox_GP(29) = ComboBox_GP29
            ComboBox_GP(30) = ComboBox_GP30
            '斜锁锁付方式
            ComBox_XFS(1) = ComboBox1
            ComBox_XFS(2) = ComboBox2
            ComBox_XFS(3) = ComboBox3
            ComBox_XFS(4) = ComboBox4
            ComBox_XFS(5) = ComboBox5
            ComBox_XFS(6) = ComboBox6
            ComBox_XFS(7) = ComboBox7
            ComBox_XFS(8) = ComboBox8
            ComBox_XFS(9) = ComboBox9
            ComBox_XFS(10) = ComboBox10
            ComBox_XFS(11) = ComboBox11
            ComBox_XFS(12) = ComboBox12
            ComBox_XFS(13) = ComboBox13
            ComBox_XFS(14) = ComboBox14
            ComBox_XFS(15) = ComboBox15
            ComBox_XFS(16) = ComboBox16
            ComBox_XFS(17) = ComboBox17
            ComBox_XFS(18) = ComboBox18
            ComBox_XFS(19) = ComboBox19
            ComBox_XFS(20) = ComboBox20
            ComBox_XFS(21) = ComboBox21
            ComBox_XFS(22) = ComboBox22
            ComBox_XFS(23) = ComboBox23
            ComBox_XFS(24) = ComboBox24
            ComBox_XFS(25) = ComboBox25
            ComBox_XFS(26) = ComboBox26
            ComBox_XFS(27) = ComboBox27
            ComBox_XFS(28) = ComboBox28
            ComBox_XFS(29) = ComboBox29
            ComBox_XFS(30) = ComboBox30
            '高度数据
            TextBox_High(1) = TextBox1_Thigh
            TextBox_High(2) = TextBox2_Thigh
            TextBox_High(3) = TextBox3_Thigh
            TextBox_High(4) = TextBox4_Thigh
            TextBox_High(5) = TextBox5_Thigh
            TextBox_High(6) = TextBox6_Thigh
            TextBox_High(7) = TextBox7_Thigh
            TextBox_High(8) = TextBox8_Thigh
            TextBox_High(9) = TextBox9_Thigh
            TextBox_High(10) = TextBox10_Thigh
            TextBox_High(11) = TextBox11_Thigh
            TextBox_High(12) = TextBox12_Thigh
            TextBox_High(13) = TextBox13_Thigh
            TextBox_High(14) = TextBox14_Thigh
            TextBox_High(15) = TextBox15_Thigh
            TextBox_High(16) = TextBox16_Thigh
            TextBox_High(17) = TextBox17_Thigh
            TextBox_High(18) = TextBox18_Thigh
            TextBox_High(19) = TextBox19_Thigh
            TextBox_High(20) = TextBox20_Thigh
            TextBox_High(21) = TextBox21_Thigh
            TextBox_High(22) = TextBox22_Thigh
            TextBox_High(23) = TextBox23_Thigh
            TextBox_High(24) = TextBox24_Thigh
            TextBox_High(25) = TextBox25_Thigh
            TextBox_High(26) = TextBox26_Thigh
            TextBox_High(27) = TextBox27_Thigh
            TextBox_High(28) = TextBox28_Thigh
            TextBox_High(29) = TextBox29_Thigh
            TextBox_High(30) = TextBox30_Thigh
            'X轴角度
            TextBox_X轴(1) = TextBox1_XZJD
            TextBox_X轴(2) = TextBox2_XZJD
            TextBox_X轴(3) = TextBox3_XZJD
            TextBox_X轴(4) = TextBox4_XZJD
            TextBox_X轴(5) = TextBox5_XZJD
            TextBox_X轴(6) = TextBox6_XZJD
            TextBox_X轴(7) = TextBox7_XZJD
            TextBox_X轴(8) = TextBox8_XZJD
            TextBox_X轴(9) = TextBox9_XZJD
            TextBox_X轴(10) = TextBox10_XZJD
            TextBox_X轴(11) = TextBox11_XZJD
            TextBox_X轴(12) = TextBox12_XZJD
            TextBox_X轴(13) = TextBox13_XZJD
            TextBox_X轴(14) = TextBox14_XZJD
            TextBox_X轴(15) = TextBox15_XZJD
            TextBox_X轴(16) = TextBox16_XZJD
            TextBox_X轴(17) = TextBox17_XZJD
            TextBox_X轴(18) = TextBox18_XZJD
            TextBox_X轴(19) = TextBox19_XZJD
            TextBox_X轴(20) = TextBox20_XZJD
            TextBox_X轴(21) = TextBox21_XZJD
            TextBox_X轴(22) = TextBox22_XZJD
            TextBox_X轴(23) = TextBox23_XZJD
            TextBox_X轴(24) = TextBox24_XZJD
            TextBox_X轴(25) = TextBox25_XZJD
            TextBox_X轴(26) = TextBox26_XZJD
            TextBox_X轴(27) = TextBox27_XZJD
            TextBox_X轴(28) = TextBox28_XZJD
            TextBox_X轴(29) = TextBox29_XZJD
            TextBox_X轴(30) = TextBox30_XZJD
            'Y轴角度
            TextBox_Y轴(1) = TextBox1_YZJD
            TextBox_Y轴(2) = TextBox2_YZJD
            TextBox_Y轴(3) = TextBox3_YZJD
            TextBox_Y轴(4) = TextBox4_YZJD
            TextBox_Y轴(5) = TextBox5_YZJD
            TextBox_Y轴(6) = TextBox6_YZJD
            TextBox_Y轴(7) = TextBox7_YZJD
            TextBox_Y轴(8) = TextBox8_YZJD
            TextBox_Y轴(9) = TextBox9_YZJD
            TextBox_Y轴(10) = TextBox10_YZJD
            TextBox_Y轴(11) = TextBox11_YZJD
            TextBox_Y轴(12) = TextBox12_YZJD
            TextBox_Y轴(13) = TextBox13_YZJD
            TextBox_Y轴(14) = TextBox14_YZJD
            TextBox_Y轴(15) = TextBox15_YZJD
            TextBox_Y轴(16) = TextBox16_YZJD
            TextBox_Y轴(17) = TextBox17_YZJD
            TextBox_Y轴(18) = TextBox18_YZJD
            TextBox_Y轴(19) = TextBox19_YZJD
            TextBox_Y轴(20) = TextBox20_YZJD
            TextBox_Y轴(21) = TextBox21_YZJD
            TextBox_Y轴(22) = TextBox22_YZJD
            TextBox_Y轴(23) = TextBox23_YZJD
            TextBox_Y轴(24) = TextBox24_YZJD
            TextBox_Y轴(25) = TextBox25_YZJD
            TextBox_Y轴(26) = TextBox26_YZJD
            TextBox_Y轴(27) = TextBox27_YZJD
            TextBox_Y轴(28) = TextBox28_YZJD
            TextBox_Y轴(29) = TextBox29_YZJD
            TextBox_Y轴(30) = TextBox30_YZJD

            '锁螺丝参数读出
            For i = 1 To 30
                TextBox_Torq(i).Text = PointPara(i).torque
                TextBox_Angle(i).Text = PointPara(i).angle
                TextBox_feeder(i).Text = PointPara(i).feeder
                Checkbox_Disable(i).Checked = PointPara(i).diable

                ComboBox_Arch(i).SelectedIndex = PointPass(i).X - 1
                ComboBox_GP(i).SelectedIndex = PointPass(i).Y
                ComboBox_SP(i).SelectedIndex = PointPass(i).Z

                ComBox_XFS(i).SelectedIndex = PointWay(i)
                TextBox_High(i).Text = PointHigh(i)
                TextBox_X轴(i).Text = Point_X轴C(i)
                TextBox_Y轴(i).Text = Point_Y轴C(i)
            Next
            ''相机扫码设定
            'If SN_CheckMode = 1 Then
            '    CCD_SN.Checked = True
            'ElseIf SN_CheckMode = 0 Then
            '    NO_CheckSN.Checked = True
            'End If

            '系统设置参数读出
            GetSystemPara()


        Catch ex As Exception
            MsgBox("initControl()" & ex.Message.ToString)
        End Try
    End Sub


    'Private Sub Button_ResultEnable_Click(sender As Object, e As EventArgs)
    '    If Button_ResultEnable.BackColor = Color.Lime Then
    '        Button_ResultEnable.BackColor = Color.WhiteSmoke
    '        Button_ResultEnable.UseVisualStyleBackColor = True
    '        Button_ResultEnable.Text = "Disable"
    '        ResultShow_flag = False
    '    Else
    '        Button_ResultEnable.BackColor = Color.Lime
    '        Button_ResultEnable.Text = "Enable"
    '        ResultShow_flag = True
    '    End If
    '    SaveEnableFlag()
    'End Sub

    'Private Sub Button_RobotEnable_Click(sender As Object, e As EventArgs)
    '    If Button_RobotEnable.BackColor = Color.Lime Then
    '        Button_RobotEnable.BackColor = Color.WhiteSmoke
    '        Button_RobotEnable.UseVisualStyleBackColor = True
    '        Button_RobotEnable.Text = "Disable"
    '        RobotPanel_flag = False
    '    Else
    '        Button_RobotEnable.BackColor = Color.Lime
    '        Button_RobotEnable.Text = "Enable"
    '        RobotPanel_flag = True
    '    End If
    '    SaveEnableFlag()
    'End Sub

    'Private Sub Button_GuideEnable_Click(sender As Object, e As EventArgs)
    '    If Button_GuideEnable.BackColor = Color.Lime Then
    '        Button_GuideEnable.BackColor = Color.WhiteSmoke
    '        Button_GuideEnable.UseVisualStyleBackColor = True
    '        Button_GuideEnable.Text = "Disable"
    '        Guide_flag = False
    '    Else
    '        Button_GuideEnable.BackColor = Color.Lime
    '        Button_GuideEnable.Text = "Enable"
    '        Guide_flag = True
    '    End If
    '    SaveEnableFlag()
    'End Sub

    Private Sub SaveEnableFlag()
        Try
            Dim filepath As String = DebugPath & "\SystemSet.txt"
            Dim OpenSystemSet As Boolean = Exists(filepath)
            Dim file_num As Integer = FreeFile()
            FileOpen(file_num, filepath, OpenMode.Random)
            FilePut(file_num, ResultShow_flag)
            FilePut(file_num, RobotPanel_flag)
            FilePut(file_num, Guide_flag)
            FileClose(file_num)
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub

    Public Sub GetEnableFlag()
        Try
            Dim filepath As String = DebugPath & "\SystemSet.txt"
            Dim OpenSystemSet As Boolean = Exists(filepath)
            Dim file_num As Integer = FreeFile()
            If OpenSystemSet = True Then
                FileOpen(file_num, filepath, OpenMode.Random)
                FileGet(file_num, ResultShow_flag)
                FileGet(file_num, RobotPanel_flag)
                FileGet(file_num, Guide_flag)
                FileClose(file_num)
            Else
                ResultShow_flag = False
                RobotPanel_flag = False
                Guide_flag = False
            End If

            'If ResultShow_flag = False Then
            '    Button_ResultEnable.Text = "Disable"
            '    Button_ResultEnable.BackColor = Color.WhiteSmoke
            '    Button_ResultEnable.UseVisualStyleBackColor = True
            'Else
            '    Button_ResultEnable.Text = "Enable"
            '    Button_ResultEnable.BackColor = Color.Lime
            'End If

            'If RobotPanel_flag = False Then
            '    Button_RobotEnable.Text = "Disable"
            '    Button_RobotEnable.BackColor = Color.WhiteSmoke
            '    Button_RobotEnable.UseVisualStyleBackColor = True
            'Else
            '    Button_RobotEnable.Text = "Enable"
            '    Button_RobotEnable.BackColor = Color.Lime
            'End If

            'If Guide_flag = False Then
            '    Button_GuideEnable.Text = "Disable"
            '    Button_GuideEnable.BackColor = Color.WhiteSmoke
            '    Button_GuideEnable.UseVisualStyleBackColor = True
            'Else
            '    Button_GuideEnable.Text = "Enable"
            '    Button_GuideEnable.BackColor = Color.Lime
            'End If

        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub

    Private Sub SaveSystemPara()
        Try
            Dim sql1 As String = ""
            Dim DBpath As String = DebugPath & "\Tool\" & TextBox_chanpin.Text & "\PointPara.accdb"
            Dim cnStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " & DBpath & ";Persist Security Info=False;Jet OLEDB:Database Password='1234';"

            '弧形参数保存---数据库PointPara
            'Arch(0).X = TextBox_Arch11.Text
            'Arch(0).Y = TextBox_Arch12.Text
            'Arch(0).Z = TextBox_Arch13.Text
            'Arch(0).A = TextBox_Arch14.Text
            sql1 = " update " & " ArchPara " & "set UpMove=" & Arch(0).X & ",DownMove=" & Arch(0).Y & ",UpPass=" & Arch(0).Z & ",DownPass=" & Arch(0).A & " where ArchNO=" & "'Arch1' and Product='" & TextBox_chanpin.Text & "'"
            ' HandleDB(sql1, cnStr)
            HandleMysql(sql1)

            'Arch(1).X = TextBox_Arch21.Text
            'Arch(1).Y = TextBox_Arch22.Text
            'Arch(1).Z = TextBox_Arch23.Text
            'Arch(1).A = TextBox_Arch24.Text
            sql1 = " update " & " ArchPara " & "set UpMove=" & Arch(1).X & ",DownMove=" & Arch(1).Y & ",UpPass=" & Arch(1).Z & ",DownPass=" & Arch(1).A & " where ArchNO=" & "'Arch2' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            'Arch(2).X = TextBox_Arch31.Text
            'Arch(2).Y = TextBox_Arch32.Text
            'Arch(2).Z = TextBox_Arch33.Text
            'Arch(2).A = TextBox_Arch34.Text
            sql1 = " update " & " ArchPara " & "set UpMove=" & Arch(2).X & ",DownMove=" & Arch(2).Y & ",UpPass=" & Arch(2).Z & ",DownPass=" & Arch(2).A & " where ArchNO=" & "'Arch3' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            'Arch(3).X = TextBox_Arch41.Text
            'Arch(3).Y = TextBox_Arch42.Text
            'Arch(3).Z = TextBox_Arch43.Text
            'Arch(3).A = TextBox_Arch44.Text
            sql1 = " update " & " ArchPara " & "set UpMove=" & Arch(3).X & ",DownMove=" & Arch(3).Y & ",UpPass=" & Arch(3).Z & ",DownPass=" & Arch(3).A & " where ArchNO=" & "'Arch4' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            '延时参数保存
            TimerDelay(0) = TextBox_timer1.Text
            ' sql1 = " update " & " TimerDelay " & "set Time=" & TimerDelay(0) & " where TimerNO=" & "'Timer1'"
            sql1 = " update " & " TimerDelay " & "set TimeSet=" & TimerDelay(0) & " where TimerNO=" & "'Timer1' and Product='" & TextBox_chanpin.Text & "'"

            HandleMysql(sql1)

            TimerDelay(1) = TextBox_timer2.Text
            sql1 = " update " & " TimerDelay " & "set TimeSet=" & TimerDelay(1) & " where TimerNO=" & "'Timer2' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            TimerDelay(2) = TextBox_timer3.Text
            sql1 = " update " & " TimerDelay " & "set TimeSet=" & TimerDelay(2) & " where TimerNO=" & "'Timer3' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)


            '避障参数保存
            Dim i As Integer = 0
            GetPass(i).X = TextBox_gpX1.Text
            GetPass(i).Y = TextBox_gpY1.Text
            GetPass(i).Z = TextBox_gpZ1.Text
            GetPass(i).C = TextBox_gpC1.Text
            sql1 = " update " & " PassSet " & "set x=" & GetPass(i).X & ",y=" & GetPass(i).Y & ",z=" & GetPass(i).Z & ",c=" & GetPass(i).C & " where PassName=" & "'GetPass" & i + 1 & "' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            SetPass(i).X = TextBox_spX1.Text
            SetPass(i).Y = TextBox_spY1.Text
            SetPass(i).Z = TextBox_spZ1.Text
            SetPass(i).C = TextBox_spC1.Text
            sql1 = " update " & " PassSet " & "set x=" & SetPass(i).X & ",y=" & SetPass(i).Y & ",z=" & SetPass(i).Z & ",c=" & SetPass(i).C & " where PassName=" & "'SetPass" & i + 1 & "' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            i = 1
            GetPass(i).X = TextBox_gpX2.Text
            GetPass(i).Y = TextBox_gpY2.Text
            GetPass(i).Z = TextBox_gpZ2.Text
            GetPass(i).C = TextBox_gpC2.Text
            sql1 = " update " & " PassSet " & "set x=" & GetPass(i).X & ",y=" & GetPass(i).Y & ",z=" & GetPass(i).Z & ",c=" & GetPass(i).C & " where PassName=" & "'GetPass" & i + 1 & "' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            SetPass(i).X = TextBox_spX2.Text
            SetPass(i).Y = TextBox_spY2.Text
            SetPass(i).Z = TextBox_spZ2.Text
            SetPass(i).C = TextBox_spC2.Text
            sql1 = " update " & " PassSet " & "set x=" & SetPass(i).X & ",y=" & SetPass(i).Y & ",z=" & SetPass(i).Z & ",c=" & SetPass(i).C & " where PassName=" & "'SetPass" & i + 1 & "' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            i = 2
            GetPass(i).X = TextBox_gpX3.Text
            GetPass(i).Y = TextBox_gpY3.Text
            GetPass(i).Z = TextBox_gpZ3.Text
            GetPass(i).C = TextBox_gpC3.Text
            sql1 = " update " & " PassSet " & "set x=" & GetPass(i).X & ",y=" & GetPass(i).Y & ",z=" & GetPass(i).Z & ",c=" & GetPass(i).C & " where PassName=" & "'GetPass" & i + 1 & "' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            SetPass(i).X = TextBox_spX3.Text
            SetPass(i).Y = TextBox_spY3.Text
            SetPass(i).Z = TextBox_spZ3.Text
            SetPass(i).C = TextBox_spC3.Text
            sql1 = " update " & " PassSet " & "set x=" & SetPass(i).X & ",y=" & SetPass(i).Y & ",z=" & SetPass(i).Z & ",c=" & SetPass(i).C & " where PassName=" & "'SetPass" & i + 1 & "' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            i = 3
            GetPass(i).X = TextBox_gpX4.Text
            GetPass(i).Y = TextBox_gpY4.Text
            GetPass(i).Z = TextBox_gpZ4.Text
            GetPass(i).C = TextBox_gpC4.Text
            sql1 = " update " & " PassSet " & "set x=" & GetPass(i).X & ",y=" & GetPass(i).Y & ",z=" & GetPass(i).Z & ",c=" & GetPass(i).C & " where PassName=" & "'GetPass" & i + 1 & "' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

            SetPass(i).X = TextBox_spX4.Text
            SetPass(i).Y = TextBox_spY4.Text
            SetPass(i).Z = TextBox_spZ4.Text
            SetPass(i).C = TextBox_spC4.Text
            sql1 = " update " & " PassSet " & "set x=" & SetPass(i).X & ",y=" & SetPass(i).Y & ",z=" & SetPass(i).Z & ",c=" & SetPass(i).C & " where PassName=" & "'SetPass" & i + 1 & "' and Product='" & TextBox_chanpin.Text & "'"
            HandleMysql(sql1)

        Catch ex As Exception

        End Try
    End Sub

    Private Sub GetSystemPara()
        Try

            '弧形参数
            'TextBox_Arch11.Text = Arch(0).X
            'TextBox_Arch12.Text = Arch(0).Y
            'TextBox_Arch13.Text = Arch(0).Z
            'TextBox_Arch14.Text = Arch(0).A

            'TextBox_Arch21.Text = Arch(1).X
            'TextBox_Arch22.Text = Arch(1).Y
            'TextBox_Arch23.Text = Arch(1).Z
            'TextBox_Arch24.Text = Arch(1).A


            'TextBox_Arch31.Text = Arch(2).X
            'TextBox_Arch32.Text = Arch(2).Y
            'TextBox_Arch33.Text = Arch(2).Z
            'TextBox_Arch34.Text = Arch(2).A


            'TextBox_Arch41.Text = Arch(3).X
            'TextBox_Arch42.Text = Arch(3).Y
            'TextBox_Arch43.Text = Arch(3).Z
            'TextBox_Arch44.Text = Arch(3).A


            '延时参数保存
            TextBox_timer1.Text = TimerDelay(0)


            TextBox_timer2.Text = TimerDelay(1)


            TextBox_timer3.Text = TimerDelay(2)



            '避障参数保存
            TextBox_gpX1.Text = GetPass(0).X
            TextBox_gpY1.Text = GetPass(0).Y
            TextBox_gpZ1.Text = GetPass(0).Z
            TextBox_gpC1.Text = GetPass(0).C

            TextBox_gpX2.Text = GetPass(1).X
            TextBox_gpY2.Text = GetPass(1).Y
            TextBox_gpZ2.Text = GetPass(1).Z
            TextBox_gpC2.Text = GetPass(1).C

            TextBox_gpX3.Text = GetPass(2).X
            TextBox_gpY3.Text = GetPass(2).Y
            TextBox_gpZ3.Text = GetPass(2).Z
            TextBox_gpC3.Text = GetPass(2).C

            TextBox_gpX4.Text = GetPass(3).X
            TextBox_gpY4.Text = GetPass(3).Y
            TextBox_gpZ4.Text = GetPass(3).Z
            TextBox_gpC4.Text = GetPass(3).C

            TextBox_spX1.Text = SetPass(0).X
            TextBox_spY1.Text = SetPass(0).Y
            TextBox_spZ1.Text = SetPass(0).Z
            TextBox_spC1.Text = SetPass(0).C

            TextBox_spX2.Text = SetPass(1).X
            TextBox_spY2.Text = SetPass(1).Y
            TextBox_spZ2.Text = SetPass(1).Z
            TextBox_spC2.Text = SetPass(1).C

            TextBox_spX3.Text = SetPass(2).X
            TextBox_spY3.Text = SetPass(2).Y
            TextBox_spZ3.Text = SetPass(2).Z
            TextBox_spC3.Text = SetPass(2).C

            TextBox_spX4.Text = SetPass(3).X
            TextBox_spY4.Text = SetPass(3).Y
            TextBox_spZ4.Text = SetPass(3).Z
            TextBox_spC4.Text = SetPass(3).C

        Catch ex As Exception

        End Try
    End Sub
    Private Sub SavePointWay()
        Dim i As Integer = 0
        Try
            Dim sql1 As String = ""
            For i = 1 To 30
                If i < 10 Then
                    sql1 = " update " & " pointpara " & "set Way=" & ComBox_XFS(i).SelectedIndex & ",High=" & TextBox_High(i).Text & ",X轴角度=" & TextBox_X轴(i).Text & ",Y轴角度=" & TextBox_Y轴(i).Text & " where PointName=" & "'set0" & i & "' and Product='" & Chanpin & "'"
                Else
                    sql1 = " update " & " pointpara " & "set Way=" & ComBox_XFS(i).SelectedIndex & ",High=" & TextBox_High(i).Text & ",X轴角度=" & TextBox_X轴(i).Text & ",Y轴角度=" & TextBox_Y轴(i).Text & " where PointName=" & "'set" & i & "' and Product='" & Chanpin & "'"
                End If
                HandleMysql(sql1)
            Next

            For i = 1 To 30
                PointWay(i) = ComBox_XFS(i).SelectedIndex
                PointHigh(i) = TextBox_High(i).Text
                Point_X轴C(i) = TextBox_X轴(i).Text
                Point_Y轴C(i) = TextBox_Y轴(i).Text
            Next

        Catch ex As Exception
            MsgBox("SavePointPara err:" & ex.Message.ToString)
        End Try
    End Sub
End Class